import { DELETE, POST, PUT } from '@/api/common.js'

const baseUrl = '/accounts/user/sub'

/**
 * 获取当前账户下子用户信息列表
 * @param params
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getCurrentAccountSubUsers = (params) => {
  return POST({
    url: `${baseUrl}/list-all`,
    params,
  })
}
/**
 * 创建子用户
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const createSubUser = (data) => {
  return POST({
    url: baseUrl,
    data,
  })
}

/**
 * 删除子用户
 * @param params
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteSubUser = (params) => {
  return DELETE({
    url: baseUrl,
    params,
  })
}

/**
 * 分配管理卖家
 * @param params
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const allocateSeller = (data) => {
  return PUT({
    url: `${baseUrl}/warehouse/assign`,
    data,
  })
}
